package com.ruoyi.ams.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.ams.domain.AmsAssetBorrow;
import com.ruoyi.ams.mapper.AmsAssetBorrowMapper;
import com.ruoyi.ams.service.IAmsAssetBorrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资产借用归还Service业务层处理
 * 
 * @author yfkj
 * @date 2022-05-16
 */
@Service
public class AmsAssetBorrowServiceImpl extends ServiceImpl<AmsAssetBorrowMapper, AmsAssetBorrow>  implements IAmsAssetBorrowService
{
    @Autowired
    private AmsAssetBorrowMapper amsAssetBorrowMapper;

    /**
     * 查询资产借用归还
     * 
     * @param borrowId 资产借用归还主键
     * @return 资产借用归还
     */
    @Override
    public AmsAssetBorrow selectAmsAssetBorrowByBorrowId(Long borrowId)
    {
        return amsAssetBorrowMapper.selectAmsAssetBorrowByBorrowId(borrowId);
    }

    /**
     * 查询资产借用归还列表
     * 
     * @param amsAssetBorrow 资产借用归还
     * @return 资产借用归还
     */
    @Override
    public List<AmsAssetBorrow> selectAmsAssetBorrowList(AmsAssetBorrow amsAssetBorrow)
    {
        return amsAssetBorrowMapper.selectAmsAssetBorrowList(amsAssetBorrow);
    }

    /**
     * 新增资产借用归还
     * 
     * @param amsAssetBorrow 资产借用归还
     * @return 结果
     */
    @Override
    public int insertAmsAssetBorrow(AmsAssetBorrow amsAssetBorrow)
    {
        amsAssetBorrow.setCreateTime(System.currentTimeMillis());
//        amsAssetBorrow.setCreateBy(SecurityUtils.getUsername());
        return amsAssetBorrowMapper.insertAmsAssetBorrow(amsAssetBorrow);
    }

    /**
     * 修改资产借用归还
     * 
     * @param amsAssetBorrow 资产借用归还
     * @return 结果
     */
    @Override
    public int updateAmsAssetBorrow(AmsAssetBorrow amsAssetBorrow)
    {
        amsAssetBorrow.setUpdateTime(System.currentTimeMillis());
//        amsAssetBorrow.setUpdateBy(SecurityUtils.getUsername());

        return amsAssetBorrowMapper.updateAmsAssetBorrow(amsAssetBorrow);
    }

    /**
     * 批量删除资产借用归还
     * 
     * @param borrowIds 需要删除的资产借用归还主键
     * @return 结果
     */
    @Override
    public int deleteAmsAssetBorrowByBorrowIds(Long[] borrowIds)
    {
        return amsAssetBorrowMapper.deleteAmsAssetBorrowByBorrowIds(borrowIds);
    }

    /**
     * 删除资产借用归还信息
     * 
     * @param borrowId 资产借用归还主键
     * @return 结果
     */
    @Override
    public int deleteAmsAssetBorrowByBorrowId(Long borrowId)
    {
        return amsAssetBorrowMapper.deleteAmsAssetBorrowByBorrowId(borrowId);
    }
}
